package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingLevel;
import com.zzyl.vo.NursingLevelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingLevelMapper {
    void insertNursingLevel(NursingLevel nursingLevel);

    void updateNursingLevel(NursingLevel nursingLevel);

    void deleteNursingLevelById(Long id);

    NursingLevel selectNursingLevelById(Long id);

    List<NursingLevelVo> getAllNursingLevels();

    Page<NursingLevelVo> selectQuery(Integer status, String name);

    @Update("update nursing_level set status =#{status} where id = #{id}")
    void updateStatus(Long id, Integer status);

    @Select("select count(*) from nursing_level where name=#{name}")
    Integer selectNursingLevelByName(String name);

    @Select("select count(*) from nursing_level where name=#{name} and id !=#{id}")
    Integer selectNursingLevel(String name, Long id);
}
